From: Christian Marangi Date: Mon, 19 Sep 2022 18:07:05 +0000 (+0200) Subject: github-merge-pr: fix typo and correctly exit on error X-Git-Url: http://git.openwrt.org/%22https:/collectd.org//%22%24PHP_SELF/%22https:/collectd.org/%22%24PHP_SELF?a=commitdiff_plain;h=8e9ba09aaa0859bc10bba82e24447a0233037994;p=maintainer-tools.git github-merge-pr: fix typo and correctly exit on error Fix typo where echo is used instead of exit for exit error condition. Signed-off-by: Christian Marangi --- diff --git a/github-merge-pr.sh b/github-merge-pr.sh index 12e7466..9bf1c65 100755 --- a/github-merge-pr.sh +++ b/github-merge-pr.sh @@ -41,12 +41,12 @@ fi if [ "$(echo "$PR_INFO" | jq -r ".maintainer_can_modify")" == "false" ]; then echo "PR #$PRID can't be force pushed by maintainers. Can't merge this PR!" >&2 - echo 4 + exit 4 fi if [ "$(echo "$PR_INFO" | jq -r ".mergeable")" == "false" ]; then echo "PR #$PRID is not mergeable for Github.com. Check the PR!" >&2 - echo 5 + exit 5 fi echo "Pulling current $BRANCH from origin" @@ -55,7 +55,7 @@ $GIT fetch origin if ! $GIT rebase origin/$BRANCH; then echo "Failed to rebase $BRANCH with origin/$BRANCH" >&2 - echo 7 + exit 7 fi PR_USER="$(echo "$PR_INFO" | jq -r ".head.user.login")" @@ -73,19 +73,19 @@ $GIT fetch $PR_USER echo "Creating branch $PR_BRANCH" if ! $GIT checkout -b $PR_BRANCH $PR_USER/$PR_BRANCH; then echo "Failed to checkout new branch $PR_BRANCH from $PR_USER/$PR_BRANCH" >&2 - echo 8 + exit 8 fi echo "Rebasing $PR_BRANCH on top of $BRANCH" if ! $GIT rebase origin/$BRANCH; then echo "Failed to rebase $PR_BRANCH with origin/$BRANCH" >&2 - echo 9 + exit 9 fi echo "Force pushing $PR_BRANCH to $PR_USER" if ! $GIT push $PR_USER HEAD --force; then echo "Failed to force push HEAD to $PR_USER" >&2 - echo 10 + exit 10 fi echo "Returning to $BRANCH" @@ -94,13 +94,13 @@ $GIT checkout $BRANCH echo "Actually merging the PR #$PRID from branch $PR_USER/$PR_BRANCH" if ! $GIT merge --ff-only $PR_USER/$PR_BRANCH; then echo "Failed to merge $PR_USER/$PR_BRANCH on $BRANCH" >&2 - echo 11 + exit 11 fi echo "Pushing to openwrt git server" if ! $GIT push; then echo "Failed to push to $BRANCH but left branch as is." >&2 - echo 12 + exit 12 fi echo "Deleting branch $PR_BRANCH"